<template>
  <div>
    <div style="width: 100%; height: 300px; float: left; margin-top: 50px">
      <div style="width: 30%; float: left">
        <div>部门管理</div>
        <template>
          <el-table :data="
              tableData.slice(
                (currentPage - 1) * pageSize,
                currentPage * pageSize
              )
            " style="width: 100%">
            <el-table-column type="selection" width="55"> </el-table-column>
            <el-table-column fixed prop="department_code" label="部门编号">
            </el-table-column>

            <el-table-column prop="name" label="部门名称"> </el-table-column>
            <el-table-column prop="" label="组织"> </el-table-column>
          </el-table>
		  <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-sizes="[5]"
            :page-size="pageSize"
            :total="tableData.length"
           layout="prev, pager, next"
          >
          </el-pagination>
        </template>
      </div>
      <div style="width: 68%; float: left; margin-left: 2%">
        <div>职位管理</div>
        <template>
          <el-table :data="
              roles.slice(
                (currentPagebm - 1) * pageSizebm,
                currentPagebm * pageSizebm
              )
            " style="width: 100%">
            <el-table-column type="selection" width="55"> </el-table-column>
            <el-table-column fixed prop="id" label="职位编号">
            </el-table-column>
            <el-table-column fixed prop="name" label="职位名称">
            </el-table-column>
            <el-table-column prop="" label="部门编号"> </el-table-column>
            <el-table-column prop="" label="部门名称"> </el-table-column>
            <el-table-column prop="" label="上级名称"> </el-table-column>
            <el-table-column prop="" label="备注"> </el-table-column>
          </el-table>
          <el-pagination
		  @size-change="handleSizeChangebm"
            @current-change="handleCurrentChangebm"
            :current-page="currentPagebm"
            :page-sizes="[5]"
            :page-size="pageSizebm"
            :total="roles.length"
            layout="prev, pager, next"
          >
          </el-pagination>
        </template>
      </div>
    </div>
    <div style="width: 100%; height: 400px; float: left; margin-top: 50px">
      <div style="width: 100%; float: left">
        <div>
          <el-button type="success" @click="rukumingxi = true"
            >添加用户</el-button
          >
          <el-button type="warning">删除用户</el-button>
        </div>
        <el-dialog
          title="添加用户"
          :visible.sync="rukumingxi"
          width="30%"
          :before-close="handleClose"
        >
          <div style="width: 100%">
            <el-form ref="form" :model="form" label-width="80px">
              <el-form-item label="用户ID">
                <el-input v-model="form.name"></el-input>
              </el-form-item>
              <el-form-item label="口令">
                <el-input v-model="form.name"></el-input>
              </el-form-item>
              <el-form-item label="重复口令">
                <el-input v-model="form.name"></el-input>
              </el-form-item>
              <el-form-item label="部门">
                <el-select v-model="form.region" placeholder="请选择活动区域">
                  <el-option label="行政部(B0201)" value="shanghai"></el-option>
                  <el-option label="销售部(B0202)" value="beijing"></el-option>
                  <el-option label="商务部(B0401)" value="shanghai"></el-option>
                  <el-option
                    label="物流仓储部(B0402)"
                    value="beijing"
                  ></el-option>
                  <el-option label="财务部(B0404)" value="shanghai"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="重复口令">
                <el-input v-model="form.name" style="width: 50px"></el-input>
                <el-input v-model="form.name" style="width: 200px"></el-input>
                <el-select
                  v-model="form.region"
                  placeholder="请选择活动区域"
                  style="width: 30px"
                >
                  <el-option label="行政部(B0201)" value="shanghai"></el-option>
                  <el-option label="销售部(B0202)" value="beijing"></el-option>
                  <el-option label="商务部(B0401)" value="shanghai"></el-option>
                  <el-option
                    label="物流仓储部(B0402)"
                    value="beijing"
                  ></el-option>
                  <el-option label="财务部(B0404)" value="shanghai"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="备注:">
                <el-input type="textarea" v-model="form.desc"></el-input>
              </el-form-item>
            </el-form>
            <div style="margin-top: 30px">
              <el-button type="primary">添加</el-button>
              <el-button type="warning">放弃</el-button>
            </div>
          </div>
        </el-dialog>
        <template>
          <el-table
            :data="
              tableData.slice(
                (currentPage - 1) * pageSize,
                currentPage * pageSize
              )
            "
            style="width: 100%"
          >
            <el-table-column type="selection" width="55"> </el-table-column>
            <el-table-column fixed prop="bianhao" label="用户账号">
            </el-table-column>

            <el-table-column prop="enddate" label="绑定人员"> </el-table-column>
            <el-table-column prop="name" label="用户密码"> </el-table-column>
            <el-table-column prop="name" label="部门编号"> </el-table-column>
            <el-table-column prop="name" label="部门"> </el-table-column>
            <el-table-column prop="name" label="最后登陆时间">
            </el-table-column>
            <el-table-column prop="name" label="备注"> </el-table-column>
          </el-table>
          <el-pagination
            @size-change="handleSizeChangebm"
            @current-change="handleCurrentChangebm"
            :current-page="currentPagebm"
            :page-sizes="[5]"
            :page-size="pageSize"
            :total="tableData.length"
            layout="total, sizes, prev, pager, next, jumper"
          >
          </el-pagination>
        </template>
      </div>
    </div>
  </div>
</template>

<script>
import { getData, postData } from "@/utils/request.js";
export default {
  data() {
    return {
      key: 1, // 为了能每次切换权限的时候重新初始化指令
      valuesj: 2024,
      dialogVisiblexiolie: false,
      diaxuanzhe: false,
      rukusaomiao: false,
      laokuan: false,
      rukumingxi: false,
      options: [
        {
          value: "1",
          label: "全部",
        },
        {
          value: "2",
          label: "已签收",
        },
        {
          value: "3",
          label: "未签收",
        },
      ],
      data: [
        {
          label: "中国大陆",
          children: [
            {
              label: "上海",
            },
            {
              label: "北京",
            },
            {
              label: "四川",
            },
          ],
        },
      ],
      value1: "",
      defaultProps: {
        children: "children",
        label: "label",
      },
      value: "",
      chanpingguige: false,
      dialogVisible: false,
      dialogVisiblea: false,
      hospital: false,
      area: false,
      currentPage: 1,
      pageSize: 5,
	  currentPagebm: 1,
	  pageSizebm: 5,
      jinxiaoshang: false,
      shouhuor: false,
      diquxuanzhe: false,
      tableData: [],
	  roles:[],
      form: {
        name: "",
        regiona: "",
        regionb: "",
        regionc: "",
        regiond: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: "",
        regioB: "",
        regioA: "",
      },
      sizeForm: {
        name: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: "",
      },
    };
  },
  created() {

	this.bumenglist()
	this.zhiweilist()
  },
  methods: {
    bumenglist() {
      var data = {
        page: 1,
        limit: 100,
        token: localStorage.getItem("token"),
      };
      postData("department/indexList", data).then((res) => {
        // 处理响应数据
        if (res.code == 0) {
          console.log(res);
          this.tableData = res.data.data;
        } else {
        }
      });
    },
	zhiweilist() {
      var data = {
        page: 1,
        limit: 100,
        token: localStorage.getItem("token"),
      };
      postData("position/indexlist", data).then((res) => {
        // 处理响应数据
        if (res.code == 0) {
          console.log(res);
          this.roles = res.data.data;
        } else {
        }
      });
    },
    onSubmit() {
      console.log("submit!");
    },
    handleClose(done) {
      done();
      // this.$confirm('确认关闭？')
      // 	.then(_ => {
      // 		done();
      // 	})
      // 	.catch(_ => {});
    },

    handleClick(row) {
      console.log(row);
    },
    handleSizeChange(val) {
		console.log(val)
      this.pageSize = val;
    },
    handleCurrentChange(val) {
      this.currentPage = val;
    },
	handleSizeChangebm(val) {
		console.log(val)
      this.pageSizebm = val;
    },
    handleCurrentChangebm(val) {
      this.currentPagebm = val;
    },
  },
};
</script>

<style>
</style>